package com.bjwl.modules.back.services.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bjwl.common.utils.PageUtils;
import com.bjwl.modules.common.pojo.MyPage;
import com.bjwl.modules.back.dao.UserDao;
import com.bjwl.modules.back.entity.UserEntity;
import com.bjwl.modules.back.services.UserService;
import org.springframework.stereotype.Service;


@Service
public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements UserService {
    public PageUtils queryPage(Long pageIndex, Long pageSize, String userName) {
        Page<UserEntity> page = new Page<>(pageIndex,pageSize);

        IPage<UserEntity> pageData=null;
        try {
            pageData = this.baseMapper.getList(page,userName);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return new PageUtils(pageData);
    }

    @Override
    public PageUtils queryPage(MyPage myPage, String userName) {
        Page<UserEntity> page = new Page<>(myPage.getPageNo(),myPage.getPageSize());

        IPage<UserEntity> pageData=null;
        try {
            pageData = this.baseMapper.getList(page,userName);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return new PageUtils(pageData);
    }
}
